define(['./module'],function(module){
	'use strict';


	module.controller("search",serversearchctrl);

	function serversearchctrl($scope, $http){





	}


	/**
	 * 提交小程序
	 */
	module.controller("updatewxsapp",serverupdatewxsappctrl);
	function serverupdatewxsappctrl($scope,$http,$location,Upload,$timeout){

		$scope.$watch('wxsheadfile', function () {
			$scope.uploadrmainfiles($scope.wxsheadfile);
		});
		$scope.allwxsheadfile = [];
		$scope.uploadrmainfiles = function (files) {
			if (files && files.length) {
				for (var i = 0; i < files.length; i++) {
					var file = files[i];
					var filename = files[i].name;
					if (!file.$error) {
						Upload.upload({
							url: '../mall/files/ajaxFileUploadsImgs',
							data: {
								file: file,
								filename: filename
							}
						}).progress(function (evt) {
						}).success(function (data, status, headers, config) {
							$timeout(function () {
								if (data.ifb.sucflag) {
									console.log(data.ifb);
									$scope.allwxsheadfile.push(data.ifb);
								}
							});
						});
					}
				}
			}
		}

		$scope.$watch('wxscodefile', function () {
			$scope.uploadwxscodefile($scope.wxscodefile);
		});
		$scope.allwxscodefile = [];
		$scope.uploadwxscodefile = function (files) {
			if (files && files.length) {
				for (var i = 0; i < files.length; i++) {
					var file = files[i];
					var filename = files[i].name;
					if (!file.$error) {
						Upload.upload({
							url: '../mall/files/ajaxFileUploadsImgs',
							data: {
								file: file,
								filename: filename
							}
						}).progress(function (evt) {
						}).success(function (data, status, headers, config) {
							$timeout(function () {
								if (data.ifb.sucflag) {
									console.log(data.ifb);
									$scope.allwxscodefile.push(data.ifb);
								}
							});
						});
					}
				}
			}
		}

	}

});
